#define _CRT_SECURE_NO_WARNINGS
#include<vector>
using namespace std;
vector<int> countBits(int n) {
    vector<int> ret(n + 1);
    for (int i = 0; i <= n; i++) {
        int count = 0;
        int tmp = i;
        while (tmp) {
            tmp = tmp & (tmp - 1);
            count++;
        }
        ret[i] = count;
    }
    return ret;
}
};